package com.wuseguang.springcloud.dao.repository;

import com.wuseguang.springcloud.entity.TeacherRatingLimit;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

public interface TeacherRatingLimitRepository extends JpaRepository<TeacherRatingLimit, Integer> {

    TeacherRatingLimit findByClassIdAndTeacherId(Integer classId, Integer teacherId);

    @Transactional
    @Modifying
    @Query(value = "DELETE FROM `teacher_rating_limit` WHERE `school_id` = ?1 ",nativeQuery = true)
    int deleteBySchoolId(Integer schoolId);
}
